cmake_minimum_required(VERSION 3.26)
project(boltDB)
set(CMAKE_CXX_STANDARD 17)

set(BOLTDB_SRC_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src/include)
set(BOLTDB_THIRD_PARTY_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third_party)

include_directories(
    ${BOLTDB_SRC_INCLUDE_DIR}
    ${BOLTDB_THIRD_PARTY_INCLUDE_DIR}
    )
add_subdirectory(src)

# 编译检查
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)

if(NOT COMPILER_SUPPORTS_CXX17)
    message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} does not support C++17.")
endif()
# 检查操作系统是否为Linux
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
    message(FATAL_ERROR "This project can only be built on Linux.")
endif()

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
# 第三方库的引入
add_subdirectory(third_party)
# 开启测试
include(CTest)
enable_testing()
add_subdirectory(test)
